<ui:composition xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:c="http://java.sun.com/jsp/jstl/core"
     xmlns:p="http://primefaces.org/ui"
     xmlns:o="http://omnifaces.org/ui"
     xmlns:jsf="http://xmlns.jcp.org/jsf">
<!-- TERMS -->
   <div class="text-right margin-bottom" 
        jsf:rendered="#{dataverseSession.user.authenticated and empty editMode and !widgetWrapper.widgetView
                        and permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset)}">
       <p:commandLink styleClass="btn btn-default btn-access" actionListener="#{DatasetPage.edit('LICENSE')}" 
                      update="@form,:messagePanel" oncomplete="javascript:bind_bsui_components();" disabled="#{DatasetPage.lockedFromEdits}">
           <f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="0" />
           <span class="glyphicon glyphicon-briefcase"/> #{bundle['file.dataFilesTab.terms.editTermsBtn']}
       </p:commandLink>
    </div>
    <div class="panel-group">
       <div class="panel panel-default">
           <div data-toggle="collapse" data-target="#panelCollapseTOU" class="panel-heading text-info">
               #{bundle['file.dataFilesTab.terms.list.termsOfUse.header']} &#160;<span class="glyphicon glyphicon-chevron-up"/>
           </div>
           <div id="panelCollapseTOU" class="collapse in">
               <p:fragment id="touFragment">
                   <o:importFunctions type="edu.harvard.iq.dataverse.util.MarkupChecker"/>
                   <o:importFunctions type="org.apache.commons.lang.StringEscapeUtils" />
                   <div class="panel-body">
                       <div class="form-group">
                           <label for="metadata_Terms" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <ui:fragment rendered="#{empty editMode}">
                                   <p class="help-block">
                                       <h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver.txt.description']}" escape="false"/>
                                   </p>
                               </ui:fragment>
                               <ui:fragment rendered="#{empty editMode and termsOfUseAndAccess.license == 'NONE'}">
                                   <p><h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfUse.no.waiver.txt']}" escape="false"/></p>
                               </ui:fragment>
                               <ui:fragment rendered="#{!empty editMode}">
                                   <p class="help-block"><h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver.description']}" escape="false"/></p>
                                   <p:selectOneRadio id="options" value="#{termsOfUseAndAccess.license}">
                                       <f:selectItem itemLabel="#{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver.select.CCO']}" itemValue="CC0" />
                                       <f:selectItem itemLabel="#{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver.select.notCCO']}" itemValue="NONE" />
                                       <p:ajax update="touFragment" oncomplete="javascript:bind_bsui_components();" />
                                   </p:selectOneRadio>
                               </ui:fragment>
                               <ui:fragment rendered="#{termsOfUseAndAccess.license == 'CC0'}">
                                   <p>#{bundle['file.dataFilesTab.terms.list.termsOfUse.waiver.txt']} <img src="/resources/images/cc0.png" alt="#{bundle['file.cc0.icon.alttxt']}" class="waiver-CC0-inline"/></p>
                               </ui:fragment>
                           </div>
                       </div>
                       <div class="form-group" jsf:rendered="#{termsOfUseAndAccess.license != 'CC0'}">
                           <label for="metadata_TermsUse" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfUse.termsOfUse']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.termsOfUse.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.termsOfUse)}" escape="false" rendered="#{empty editMode}"/>
                               <ui:fragment rendered="#{!empty editMode}">
                                   <p class="help-block"><h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfUse.termsOfUse.description']}" escape="false"/></p>
                                   <p:inputTextarea value="#{termsOfUseAndAccess.termsOfUse}" rows="5" cols="60" styleClass="form-control" />
                               </ui:fragment>
                           </div>
                       </div>

                       <!-- Additional Information -->
                        <ui:fragment rendered="#{empty editMode}">
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.confidentialityDeclaration}">
                                <label for="confidentialityDeclaration" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.declaration']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.declaration.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.confidentialityDeclaration)}" escape="false"/>
                                </div>
                            </div>
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.specialPermissions}">
                                <label for="specialPermissions" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.permissions']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.permissions.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.specialPermissions)}" escape="false"/>
                                </div>
                            </div>
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.restrictions}">
                                <label for="restrictions" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.restrictions']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.restrictions.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.restrictions)}" escape="false"/>
                                </div>
                            </div>
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.citationRequirements}">
                                <label for="citationRequirements" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.citationRequirements']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.citationRequirements.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.citationRequirements)}" escape="false"/>
                                </div>
                            </div>
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.depositorRequirements}">
                                <label for="depositorRequirements" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.depositorRequirements']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.depositorRequirements.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.depositorRequirements)}" escape="false"/>
                                </div>
                            </div>
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.conditions}">
                                <label for="conditions" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.conditions)}" escape="false"/>
                                </div>
                            </div>
                            <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.disclaimer}">
                                <label for="disclaimer" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.disclaimer)}" escape="false"/>
                                </div>
                            </div>
                        </ui:fragment>
                        <ui:fragment rendered="#{!empty editMode}">
                            <div class="form-group">
                                <label for="confidentialityDeclaration" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.declaration']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.declaration.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="confidentialityDeclaration" value="#{termsOfUseAndAccess.confidentialityDeclaration}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="specialPermissions" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.permissions']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.permissions.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="specialPermissions" value="#{termsOfUseAndAccess.specialPermissions}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="restrictions" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.restrictions']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.restrictions.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="restrictions" value="#{termsOfUseAndAccess.restrictions}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="citationRequirements" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.citationRequirements']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.citationRequirements.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="citationRequirements" value="#{termsOfUseAndAccess.citationRequirements}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="depositorRequirements" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.depositorRequirements']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.depositorRequirements.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="depositorRequirements" value="#{termsOfUseAndAccess.depositorRequirements}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="conditions" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="conditions" value="#{termsOfUseAndAccess.conditions}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="disclaimer" class="col-sm-3 control-label">
                                    #{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer']}
                                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer.title']}"></span>
                                </label>
                                <div class="col-sm-9">
                                    <p:inputTextarea id="disclaimer" value="#{termsOfUseAndAccess.disclaimer}" rows="5" cols="60" styleClass="form-control" />
                                </div>
                            </div>
                        </ui:fragment>
                       <!-- END: Additional Information -->
                   </div>
               </p:fragment>
           </div>
       </div>

       <div class="panel panel-default" jsf:rendered="#{!empty editMode or empty editMode and (!empty termsOfUseAndAccess.termsOfAccess
                                                        or !empty termsOfUseAndAccess.dataAccessPlace 
                                        or !empty termsOfUseAndAccess.originalArchive or !empty termsOfUseAndAccess.availabilityStatus 
                                        or !empty termsOfUseAndAccess.contactForAccess or !empty termsOfUseAndAccess.sizeOfCollection 
                                        or !empty termsOfUseAndAccess.studyCompletion)}">
           <div data-toggle="collapse" data-target="#panelCollapseTOA" class="panel-heading text-info">
               <h:outputText value="#{settingsWrapper.publicInstall ? bundle['file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess'] : bundle['file.dataFilesTab.terms.list.termsOfAccess.header']}"/>
               &#160;<span class="glyphicon glyphicon-chevron-up"/>
           </div>
           <div id="panelCollapseTOA" class="collapse in">
               <div class="panel-body">
                   <ui:fragment rendered="#{empty editMode}">
                       <div class="form-group" jsf:rendered="#{!settingsWrapper.publicInstall}">
                           <label for="metadata_RestrictedFiles" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <p>
                                   <h:outputFormat value="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.txt']}">
                                       <f:param value="#{DatasetPage.restrictedFileCount}"/>
                                   </h:outputFormat>
                               </p>
                           </div>
                       </div>
                       <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.termsOfAccess}">
                           <label for="metadata_TermsAccess" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <p><h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.termsOfAccess)}" escape="false"/></p>
                           </div>
                       </div>
                       <div class="form-group" jsf:rendered="#{!settingsWrapper.publicInstall and (DatasetPage.restrictedFileCount > 0)}">
                           <label for="metadata_RequestAccess" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <p jsf:rendered="#{!DatasetPage.workingVersion.draft}">
                                   <h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.request']}" rendered="#{DatasetPage.dataset.fileAccessRequest}"/>
                                   <h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.notRequest']}" rendered="#{!DatasetPage.dataset.fileAccessRequest}"/>
                               </p>
                               <p jsf:rendered="#{DatasetPage.workingVersion.draft}">
                                   <h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.request']}" rendered="#{DatasetPage.workingVersion.termsOfUseAndAccess.fileAccessRequest}"/>
                                   <h:outputText value="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.notRequest']}" rendered="#{!DatasetPage.workingVersion.termsOfUseAndAccess.fileAccessRequest}"/>
                               </p>
                           </div>
                       </div>
                   </ui:fragment>
                   <ui:fragment rendered="#{!empty editMode}">
                       <div class="form-group">
                           <label for="metadata_TermsAccess" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <p:inputTextarea value="#{termsOfUseAndAccess.termsOfAccess}" rows="5" styleClass="form-control" />
                       </div>
                       </div>
                       <div class="form-group" jsf:rendered="#{!settingsWrapper.publicInstall}">
                           <label for="metadata_RequestAccess" class="col-sm-3 control-label">
                               #{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess']}
                               <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                     data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.title']}"></span>
                           </label>
                           <div class="col-sm-9">
                               <p:selectBooleanCheckbox id="requestAccess" itemLabel="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess.enableBtn']}" value="#{termsOfUseAndAccess.fileAccessRequest}"/>
                           </div>
                       </div>
                   </ui:fragment>

                   <!-- Additional Information -->
                    <ui:fragment rendered="#{empty editMode}">
                        <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.dataAccessPlace}">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.dataAccessPlace']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.dataAccessPlace.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.dataAccessPlace)}" escape="false"/>
                            </div>
                        </div>
                        <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.originalArchive}">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.originalArchive']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.originalArchive.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.originalArchive)}" escape="false"/>
                            </div>
                        </div>
                        <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.availabilityStatus}">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.availabilityStatus']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.availabilityStatus.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.availabilityStatus)}" escape="false"/>
                            </div>
                        </div>
                        <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.contactForAccess}">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.contactForAccess']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.contactForAccess.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.contactForAccess)}" escape="false"/>
                            </div>
                        </div>
                        <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.sizeOfCollection}">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection.tip']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.sizeOfCollection)}" escape="false"/>
                            </div>
                        </div>
                        <div class="form-group" jsf:rendered="#{!empty termsOfUseAndAccess.studyCompletion}">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <h:outputText value="#{MarkupChecker:sanitizeBasicHTML(termsOfUseAndAccess.studyCompletion)}" escape="false"/>
                            </div>
                        </div>
                    </ui:fragment>
                    <ui:fragment rendered="#{!empty editMode}">
                        <div class="form-group">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.dataAccessPlace']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.dataAccessPlace.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <p:inputTextarea value="#{termsOfUseAndAccess.dataAccessPlace}" rows="5" cols="60" styleClass="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.originalArchive']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.originalArchive.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <p:inputTextarea value="#{termsOfUseAndAccess.originalArchive}" rows="5" cols="60" styleClass="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.availabilityStatus']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.availabilityStatus.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <p:inputTextarea value="#{termsOfUseAndAccess.availabilityStatus}" rows="5" cols="60" styleClass="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.contactForAccess']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.contactForAccess.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <p:inputTextarea value="#{termsOfUseAndAccess.contactForAccess}" rows="5" cols="60" styleClass="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.sizeOfCollection.tip']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <p:inputTextarea value="#{termsOfUseAndAccess.sizeOfCollection}" rows="5" cols="60" styleClass="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="metadata_TermsUse" class="col-sm-3 control-label">
                                #{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion']}
                                <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                      data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion.title']}"></span>
                            </label>
                            <div class="col-sm-9">
                                <p:inputTextarea value="#{termsOfUseAndAccess.studyCompletion}" rows="5" cols="60" styleClass="form-control" />
                            </div>
                        </div>
                    </ui:fragment>
                   <!-- END: Additional Information -->
               </div>
           </div>
       </div>

        <div class="panel panel-default" jsf:rendered="#{!settingsWrapper.rsyncOnly and (managePage==false or datasetPage == true)}">
           <div data-toggle="collapse" data-target="#panelCollapseGuestbook" class="panel-heading text-info">
               #{bundle['file.dataFilesTab.terms.list.guestbook']} &#160;<span class="glyphicon glyphicon-chevron-up"/>
           </div>
           <div id="panelCollapseGuestbook" class="collapse in">
               <div class="panel-body">
                   <div class="form-group">
                       <label for="metadata_Guestbook" class="col-sm-3 control-label">
                           #{bundle['file.dataFilesTab.terms.list.guestbook']}
                           <span class="glyphicon glyphicon-question-sign tooltip-icon"
                                 data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['file.dataFilesTab.terms.list.guestbook.title']}"></span>
                       </label>
                       <div class="col-sm-9">
                           <ui:fragment rendered="#{empty editMode}">
                               <ui:fragment rendered="#{ datasetPage and empty DatasetPage.dataset.guestbook 
                                                        and ((!dataverseSession.user.authenticated or !permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset))
                                                        or ((dataverseSession.user.authenticated and permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset) 
                                                           and !empty DatasetPage.dataset.dataverseContext.availableGuestbooks)))}">
                                   <p>#{bundle['file.dataFilesTab.terms.list.guestbook.noSelected.tip']}</p>
                               </ui:fragment>
                               <ui:fragment rendered="#{empty DatasetPage.dataset.guestbook 
                                                 and (dataverseSession.user.authenticated and permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset))
                                                 and empty DatasetPage.dataset.dataverseContext.availableGuestbooks}">
                                   <p>
                                       <h:outputFormat value="#{bundle['file.dataFilesTab.terms.list.guestbook.noSelected.admin.tip']}">
                                           <f:param value="#{DatasetPage.dataset.owner.name}"/>
                                       </h:outputFormat>
                                   </p>
                               </ui:fragment>

                               <ui:fragment rendered="#{!empty DatasetPage.dataset.guestbook}">
                                   <p class="help-block">#{bundle['file.dataFilesTab.terms.list.guestbook.inUse.tip']}</p>
                                   <div class="panel panel-default">
                                       <div class="panel-body">
                                           <p class="form-control-static pull-left">#{DatasetPage.dataset.guestbook.name}</p>
                                           <p:commandButton styleClass="btn btn-default pull-right"
                                                          value="#{bundle['file.dataFilesTab.terms.list.guestbook.viewBtn']}"
                                                          action="#{DatasetPage.viewSelectedGuestbook(DatasetPage.dataset.guestbook)}"
                                                          update=":datasetForm" oncomplete="PF('viewGuestbook').show();bind_bsui_components();"/>
                                       </div>
                                   </div>
                               </ui:fragment>
                           </ui:fragment>
                           <ui:fragment rendered="#{!empty editMode and datasetPage}">
                               <p class="help-block">#{bundle['file.dataFilesTab.terms.list.guestbook.select.tip']}</p>

                               <ui:fragment rendered="#{empty DatasetPage.dataset.dataverseContext.availableGuestbooks}">
                                   <p class="help-block">
                                       <h:outputFormat value="#{bundle['file.dataFilesTab.terms.list.guestbook.noAvailable.tip']}">
                                           <f:param value="#{DatasetPage.dataset.owner.name}"/>
                                       </h:outputFormat>
                                   </p>
                               </ui:fragment>

                               <ui:fragment rendered="#{!empty DatasetPage.dataset.dataverseContext.availableGuestbooks}">
                                   <p:commandButton styleClass="btn btn-default"
                                                    value="#{bundle['file.dataFilesTab.terms.list.guestbook.clearBtn']}" 
                                                    rendered="#{!empty DatasetPage.dataset.guestbook}"
                                                    update="guestbookTable" process="@this" actionListener="#{DatasetPage.reset}"/>
                                   <p:dataTable id="guestbookTable" styleClass="headerless-table margin-top"
                                                value="#{DatasetPage.dataset.dataverseContext.availableGuestbooks}" var="guestbook" widgetVar="guestbookTable"
                                                rendered="#{!empty DatasetPage.dataset.dataverseContext.availableGuestbooks}"
                                                rowIndexVar="rowNum" selection="#{DatasetPage.dataset.guestbook}" rowKey="#{guestbook}">
                                       <p:column selectionMode="single" class="col-select-width text-center"/>
                                       <p:column>
                                           <p class="form-control-static pull-left">
                                               <h:outputText value="#{guestbook.name}"/>
                                           </p>
                                           <p:commandButton styleClass="btn btn-default pull-right"
                                                          value="#{bundle['file.dataFilesTab.terms.list.guestbook.viewBtn']}"
                                                          action="#{DatasetPage.viewSelectedGuestbook(guestbook)}"
                                                          update=":datasetForm" oncomplete="PF('viewGuestbook').show();bind_bsui_components();"/>
                                       </p:column>
                                   </p:dataTable>
                               </ui:fragment>
                           </ui:fragment>
                       </div>
                   </div>
               </div>
           </div>
       </div> 
    </div>
    <!-- / TERMS -->

    <!-- Preview Guestbook -->
    <p:dialog id="previewGuestbook" styleClass="largePopUp" header="#{bundle['dataset.manageGuestbooks.tab.action.btn.view.dialog.header']}" widgetVar="viewGuestbook" modal="true">
        <div class="form-horizontal">
            <p class="help-block">
                #{bundle['dataset.manageGuestbooks.tab.action.btn.view.dialog.datasetGuestbook.title']}
            </p>
            <div class="form-group">
                <label class="col-sm-3 control-label">
                    #{bundle['dataset.manageGuestbooks.tab.action.btn.view.dialog.datasetGuestbook']}
                </label>
                <div class="col-sm-8">
                    <p class="form-control-static">
                        #{DatasetPage.selectedGuestbook.name}
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">
                    #{bundle['dataset.manageGuestbooks.tab.action.btn.view.dialog.userCollectedData']}
                    <span class="glyphicon glyphicon-question-sign tooltip-icon"
                          data-toggle="tooltip" data-placement="auto right" data-original-title="#{bundle['dataset.manageGuestbooks.tab.action.btn.view.dialog.userCollectedData.title']}"></span>
                </label>
                <div class="col-sm-8">
                    <p class="form-control-static">
                        <h:outputText value="#{bundle['dataset.manageGuestbooks.guestbook.accountInformation']}"/>
                        <ul>
                            <ui:repeat value="#{DatasetPage.selectedGuestbook.requiredAccountInformation}" var="ai">
                                <li>
                                    <h:outputText value="#{ai} #{bundle['dataset.manageGuestbooks.guestbook.required']}"/>
                                </li>
                            </ui:repeat>
                            <ui:repeat value="#{DatasetPage.selectedGuestbook.optionalAccountInformation}" var="ai">
                                <li>
                                    <h:outputText value="#{ai} #{bundle['dataset.manageGuestbooks.guestbook.optional']}"/>
                                </li>
                            </ui:repeat>
                        </ul>
                    </p>
                    
                    <ui:fragment rendered="#{!empty DatasetPage.selectedGuestbook.requiredQuestionsList or !empty DatasetPage.selectedGuestbook.optionalQuestionsList}">
                    <p class="form-control-static">
                        <h:outputText value="#{bundle['dataset.manageGuestbooks.guestbook.customQuestions']}"/>
                        <ul>
                            <ui:repeat value="#{DatasetPage.selectedGuestbook.requiredQuestionsList}" var="q">
                                <li>
                                    <h:outputText value="#{q} #{bundle['dataset.manageGuestbooks.guestbook.required']}"/>
                                </li>
                            </ui:repeat>
                            <ui:repeat value="#{DatasetPage.selectedGuestbook.optionalQuestionsList}" var="q">
                                <li>
                                    <h:outputText value="#{q} #{bundle['dataset.manageGuestbooks.guestbook.optional']}"/>
                                </li>
                            </ui:repeat>
                        </ul>
                    </p>
                    </ui:fragment>
                </div>
            </div>
        </div>
        <div class="button-block">
            <button class="btn btn-default" onclick="PF('viewGuestbook').hide()" type="button">
                #{bundle.close}
            </button>
        </div>
    </p:dialog>
    <!-- / Preview Guestbook -->
</ui:composition>